/*
 * @Author: Admin zhaojihai2012@163.com
 * @Date: 2024-01-29 13:12:30
 * @LastEditors: Admin zhaojihai2012@163.com
 * @LastEditTime: 2024-01-29 13:20:08
 * @FilePath: \kd686-esp32s3-can\components\kd686bsp\ec_bsp_gpio.c
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include "ec_bsp_gpio.h"

void ec_bsp_gpio_init(void)
{
	gpio_config_t   io_conf = {};

    io_conf.mode         = GPIO_MODE_OUTPUT;
    io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
    io_conf.pull_up_en   = GPIO_PULLUP_DISABLE;
    io_conf.intr_type    = GPIO_INTR_DISABLE;
    io_conf.pin_bit_mask = (1ULL << EC_GPIO_POWER_CTL);    /*KP,电源控制管脚*/

    gpio_config(&io_conf);

    ec_bsp_power_on();       /*KP线拉高，稳定供电*/

    io_conf.mode         = GPIO_MODE_INPUT;
    io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
    io_conf.pull_up_en   = GPIO_PULLUP_ENABLE;
    io_conf.intr_type    = GPIO_INTR_DISABLE;
    io_conf.pin_bit_mask = (1ULL << EC_GPIO_USB_CHARGE);   /*充电检测管脚*/

    gpio_config(&io_conf);

#if USE_CHARGE_GPIO
    io_conf.mode         = GPIO_MODE_INPUT;
    io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE;
    io_conf.pull_up_en   = GPIO_PULLUP_ENABLE;
    io_conf.intr_type    = GPIO_INTR_DISABLE;
    io_conf.pin_bit_mask = (1ULL << GPIO_CHARGE_DET);   /*充电检测管脚*/

    gpio_config(&io_conf);
#endif
}